lib/repo-commit: Relax min-free-space check in prepare_transaction()
authorUmang Jain <umang@endlessm.com>
Wed, 5 Dec 2018 22:56:22 +0000 (04:26 +0530)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 10 Dec 2018 20:04:17 +0000 (20:04 +0000)
commit963395217aa4db4e22bd941aeef675464588d708
tree43fbf1b009241f09444354b9035427e16d7557d7
parent3ecbdd81973dc706ddce1f28876533f81bb6889a
lib/repo-commit: Relax min-free-space check in prepare_transaction()

We want a case where we can disable the min-free-space check. Initially,
it felt like to add a OSTREE_REPO_PULL_FLAGS_DISABLE_FREE_SPACE_CHECK but
the problem is prepare_transaction() does not have a OstreeRepoPullFlags
parameter which we can parse right here. On top of it, prepare_transaction()
enforces min-free-space check and won't let the transaction proceed if
the check failed.

This is pretty bad in conjunction with "inherit-transaction" as what
Flatpak uses. There is no way to disable this check unless we remove
it altogether from prepare_transaction.

This issue came out to light when flatpak wasn't able to write metadata
after fetching from remote:

[uajain@localhost ~]$ flatpak remote-info flathub org.kde.Platform//5.9
error: min-free-space-size 500MB would be exceeded

Metadata objects helps in housekeeping and restricting them means
restricting crucial UX (like search, new updates) functionalities
in clients like gnome-software. The error banners originated from
these issues are also abrupt and not much helpful to the user. This
is the specific instance of the issue this patches tries to address.

See https://github.com/flatpak/flatpak/issues/2139 for discussion.

Closes: #1779
Approved by: mwleeds
src/libostree/ostree-repo-commit.c
tests/installed/nondestructive/itest-pull-space.sh